﻿using System.Data.Entity.ModelConfiguration;
namespace wh40klbModel.ModelConfiguration
{
    class ArmyConfiguration : EntityTypeConfiguration<Army>
    {
        public ArmyConfiguration()
        {
            //Cle Primaire et table
            ToTable("Armies");
            HasKey(s => s.Id);
            //Propriete
            Property(d => d.Name).IsRequired();
            Property(d => d.Name).HasMaxLength(25);
            //cle etrangere
            HasMany(a => a.Infantries).WithRequired(i => i.Army);
            HasMany(a => a.Vehicules).WithRequired(v => v.Army);
            HasMany(a => a.ArmySquadTypeUseds).WithRequired(astu=>astu.Army);
        }
    }

}
